;; -*- lexical-binding: t; -*-
;;; Fire up package.el

;; auto recompile packages please.
;;(setq package-enable-at-startup nil)
;;(setq load-prefer-newer t)
;;(package-initialize)
;;(use-package auto-compile )
;;(auto-compile-on-load-mode)
;;(auto-compile-on-save-mode)

;; don't show me issues in a new window everytime
(setq auto-compile-display-buffer nil)
(setq auto-compile-mode-line-counter t)



(defun sanityinc/set-tabulated-list-column-width (col-name width)
  "Set any column with name COL-NAME to the given WIDTH."
  (cl-loop for column across tabulated-list-format
           when (string= col-name (car column))
           do (setf (elt column 1) width)))

(defun sanityinc/maybe-widen-package-menu-columns ()
  "Widen some columns of the package menu table to avoid truncation."
  (when (boundp 'tabulated-list-format)
    (sanityinc/set-tabulated-list-column-width "Version" 13)
    (let ((longest-archive-name (apply 'max (mapcar 'length (mapcar 'car package-archives)))))
      (sanityinc/set-tabulated-list-column-width "Archive" longest-archive-name))))

(add-hook 'package-menu-mode-hook 'sanityinc/maybe-widen-package-menu-columns)

;;(add-to-list 'package-archives ' ())
;;(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
;; I need this here so I can install org-plus-contrib
;; (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))

;; no one uses melpa stable
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(provide 'init-elpa)
